<form action="" class="form-horizontal" role="form">

	<div class="form-group">
		<label class="col-sm-1 control-label">广告标题</label>
		<div class="col-sm-5">
			<input type="text" id="name" class="form-control" name="name" placeholder="" datatype="*" value="{$ad.name}"/>
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-1 control-label">广告图片</label>
		<div class="col-sm-5">
			<input type="text" id="img-url" name="pic" class="form-control margin-bottom" value="{$ad.pic}"/>
			<input type="file" name="file_upload" id="image_upload" />
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-1 control-label">内容</label>
		<div class="col-sm-5">
			<script id="autoreply-img-txt-content" type="text/plain">{$ad.content}</script>
		</div>
	</div>
	
	<div class="form-group">
		<div class="col-sm-offset-1 col-sm-8">
			<input type="hidden"  name="id" value={$ad.id}/>
			<button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/modifyPost">保存更改</button>
		</div>
	</div>
</form>
<section class="msg-privew col-sm-4" id="msg-privew">
	<h3 class="msg-title">{$ad.name}</h3>
	<div class="msg-cover">
		<img src="{$ad.pic}"/>
	</div>
</section>
<style type="text/css">
	.panel-body{position: relative;}
	.msg-privew{position: absolute; right: 20px; top: 80px; border: 1px solid #ccc; border-radius: 5px; padding:0 10px 10px 10px; width:360px;}
	.msg-privew .msg-cover{height:160px; overflow:hidden;}
	.msg-privew img{width: 100%; background: #eee; border:none;}
</style>
<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Partner/Default/uploadify/uploadify.css">
<script type="text/javascript" src="__PUBLIC__/Style/Partner/Default/uploadify/jquery.uploadify.min.js?{:rand(0,9999)}"></script>
<script>
$(function() {
    $("#image_upload").uploadify({
        'multi'			:	false,
        'fileSizeLimit' : 	'200kb',
        'buttonText'	:	'选择图片',
        'fileTypeDesc' 	: 	'Image Files',
        'fileTypeExts' 	: 	'*.jpg; *.png',
        'swf'			: 	'__PUBLIC__/Style/My/Default/uploadify/uploadify.swf',
        'uploader'		: 	'__MODULE__/Upload/uploadOne',
        'onUploadSuccess'	: function(data, res){
        	
        	var url = eval("(" + res + ")").extra.url;
        	$("#msg-privew .msg-cover img").attr("src", url);
        	$("#img-url").val( url );
        	
        }
    });
});

//图文填写预览
$(function(){
	$("#name").keyup(function(){
		var msg = ( $(this).val().length == 0 ) ? "图文标题" : ( $(this).val() );
		$("#msg-privew .msg-title").html( msg );
	});
});
</script>

<!-- umeditor -->
<link rel="stylesheet" href="/ue/themes/default/css/ueditor.min.css">
<script type="text/javascript" src="/ue/ueditor.config.js"></script>
<script type="text/javascript" src="/ue/ueditor.all.js"></script>
<script type="text/javascript">
	window.UEDITOR_HOME_URL = "/ue/";
    
    var editor = UE.getEditor("autoreply-img-txt-content",{
    	initialFrameWidth: "100%",
	    initialFrameHeight: 300,
	    textarea: "content"
    });
    
</script>